import Vue from 'vue'
import VueRouter from 'vue-router'

import HomeView from '../views/HomeView.vue'
import AboutView from '../views/AboutView.vue'

Vue.use(VueRouter)

export default new VueRouter({
  mode: 'history',
  routes: [
    // {
    //   path: '/',
    //   redirect: '/home'
    // },
    {
      path: '/home',
      name: 'HomeView',
      component: HomeView,
      children: [
        {
          // 访问路径：/home/child
          path: 'child',
          component: () => import('../components/BBBB.vue')
        },
        {
          // 访问路径： /haha
          path: '/haha',
          component: () => import('../components/BBBB.vue')
        }
      ]
    },
    {
      path: '/about/:name',
      component: AboutView,
      props: true
    },
    {
      path: '*',
      component: () => import('../views/NotFound.vue')
    }
  ]
})
